home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 5 / Engine / DeviceEnumeration.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-10-01  |  2.3 KB  |  58 lines

  1. //-----------------------------------------------------------------------------
  2. // Used for enumerating Direct3D devices. A dialog is provided to allow the
  3. // user to select a supported device configuration.
  4. //
  5. // Programming a Multiplayer First Person Shooter in DirectX
  6. // Copyright (c) 2004 Vaughan Young
  7. //-----------------------------------------------------------------------------
  8. #ifndef DEVICE_ENUMERATION_H
  9. #define DEVICE_ENUMERATION_H
  10.  
  11. //-----------------------------------------------------------------------------
  12. // Display Mode Structure
  13. //-----------------------------------------------------------------------------
  14. struct DisplayMode
  15. {
  16.     D3DDISPLAYMODE mode; // Direct3D display mode.
  17.     char bpp[6]; // Colour depth expressed as a character string for display.
  18. };
  19.  
  20. //-----------------------------------------------------------------------------
  21. // Device Enumeration Class
  22. //-----------------------------------------------------------------------------
  23. class DeviceEnumeration
  24. {
  25. public:
  26.     INT_PTR Enumerate( IDirect3D9 *d3d );
  27.  
  28.     INT_PTR SettingsDialogProc( HWND dialog, UINT uiMsg, WPARAM wParam, LPARAM lParam );
  29.  
  30.     D3DDISPLAYMODE *GetSelectedDisplayMode();
  31.     bool IsWindowed();
  32.     bool IsVSynced();
  33.  
  34. private:
  35.     void ComboBoxAdd( HWND dialog, int id, void *data, char *desc );
  36.     void ComboBoxSelect( HWND dialog, int id, int index );
  37.     void ComboBoxSelect( HWND dialog, int id, void *data );
  38.     void *ComboBoxSelected( HWND dialog, int id );
  39.     bool ComboBoxSomethingSelected( HWND dialog, int id );
  40.     int ComboBoxCount( HWND dialog, int id );
  41.     bool ComboBoxContainsText( HWND dialog, int id, char *text );
  42.  
  43. private:
  44.     Script *m_settingsScript; // Script which stores the device configuration.
  45.  
  46.     D3DADAPTER_IDENTIFIER9 m_adapter; // Direct3D adapter identifier.
  47.     LinkedList< DisplayMode > *m_displayModes; // Linked list of enumerated display modes.
  48.     D3DDISPLAYMODE m_selectedDisplayMode; // User selected display mode.
  49.     bool m_windowed; // Indicates if the application should run in windowed mode.
  50.     bool m_vsync; // Inidicates if v-sync should be enabled.
  51. };
  52.  
  53. //-----------------------------------------------------------------------------
  54. // Externals
  55. //-----------------------------------------------------------------------------
  56. extern DeviceEnumeration *g_deviceEnumeration;
  57.  
  58. #endif